import request from "../request.js";

//请求前缀
const PREFIX = "/soUser";

export function doLogin(data) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/web/login`,
    method: "POST",
    data: data,
  });
}

export function getUserInfo() {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/web/info`,
    method: "GET"
  });
}

export function findUserList(pageNo,pageSize,username) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/paginQuery?page=${pageNo}&size=${pageSize}`,
    method: "POST",
    data: {name:username},
  });
}

export function queryRoles(userId) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/web/roles/${userId}`,
    method: "GET",
  });
}

export function save(data) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}`,
    method: "POST",
    data: data,
  });
}

export function saveRoles(userId, data) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/web/save/roles/${userId}`,
    method: "POST",
    data: data,
  });
}